import java.util.Arrays;

public class LeetCode1877 {

    public static void main(String[] args) {
        int[] nums = {3, 5, 2, 3};

        System.out.println(minPairSum(nums));
    }

    public static int minPairSum(int[] nums) {
        int n = nums.length;
        int res = 0;
        Arrays.sort(nums);
        for (int i = 0; i < n / 2; i++) {
            res = Math.max(res, nums[i] + nums[n - i - 1]);
        }
        return res;
    }
}
